import {useModal} from "vue-final-modal";

/**
 * 弹框函数
 * @param component 弹框组件
 * @param props 传递的参数
 * @param callback 回调函数
 */
export const useDialog = (component: Component, props:Record<string, any>, callback: Function) => {
    const {open, close} = useModal({
        component: component,
        attrs: {
            ...props,
            onConfirm() {
                callback();
            },
            onClose() {
                close().then(r => {
                });
            }
        }
    })
    open().then(r => {
    });
}
